﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Do_an_C_sharp
{
    public partial class UCtimkiem : UserControl
    {
        public UCtimkiem()
        {
            InitializeComponent();
        }
        public string tratri()
        {
            if (radioTimtheoma.Checked == true)
                return txtTimtheoma.Text.Trim();
            return txtTimtheoten.Text.Trim();
        }
        public bool isTimtheoma()
        {
            if (radioTimtheoma.Checked == true)
                return true;
            return false;
        }
        private void UCtimkiem_Load(object sender, EventArgs e)
        {
            radioTimtheoma.Checked = true;
        }

        private void radioTimtheoma_CheckedChanged(object sender, EventArgs e)
        {
            if (radioTimtheoma.Checked == true)
            {
                txtTimtheoma.Enabled = true;
                txtTimtheoten.Enabled = false;
            }
            else
            {
                txtTimtheoma.Enabled = false;
                txtTimtheoten.Enabled = true;
            }
        }

        private void txtTimtheoma_Click(object sender, EventArgs e)
        {
            TextBox t = (TextBox)sender;
            if (t.Name == "txtTimtheoma")
                txtTimtheoma.SelectAll();
            if (t.Name == "txtTimtheoten")
                txtTimtheoten.SelectAll();
        }
    }
}
